<template>
  <div>
    <el-button @click="show">show me</el-button>
    <KunkkaFormTablePopup :single="false" :single-click="true" />
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  data() {
    return {
    }
  },
  computed: {
    ...mapGetters(['kunkkaFormTablePopup'])
  },
  methods: {
    show() {
      this.kunkkaFormTablePopup.visible = true
      // 根据数据库id获取配置文件信息....
      this.kunkkaFormTablePopup.name = 'aaa'
      this.kunkkaFormTablePopup.uid = '100'
      this.kunkkaFormTablePopup.form = {
        conditions: [
          {
            label: '工号',
            prop: 'gonghao',
            type: 'input',
            show: true
          },
          {
            label: '姓名',
            prop: 'name',
            type: 'input',
            show: true
          },
          {
            label: '公司',
            prop: 'gs',
            type: 'input',
            show: true
          },
          {
            label: '部门',
            prop: 'bm',
            type: 'input',
            show: true
          }
        ],
        rules: {
          gonghao: [
            { required: true, message: '请输入', trigger: 'blur' }
          ]
        },
        model: {
          gonghao: '10000'
        },
        handle: [
          {
            label: '查询',
            vaild: true,
            handle: ''
          },
          {
            label: '重置'
          }
        ]
      }
      this.kunkkaFormTablePopup.table = {
        handle: [],
        columns: [
          {
            label: 'aaa',
            prop: 'aaa',
            type: 'input',
            show: true
          },
          // swipe
          {
            label: 'bbb',
            prop: 'bbb',
            type: 'input',
            show: true
          },
          {
            label: 'ccc',
            prop: 'ccc',
            type: 'input',
            show: true
          },
          // swipe
          {
            label: 'ddd',
            prop: 'ddd',
            type: 'input',
            show: true
          }
        ],
        data: [],
        pagination: {
          page: 1,
          rows: 100,
          total: 0
        }
      },
      this.kunkkaFormTablePopup.handle = [
        {
          label: '确定',
          vaild: true,
          handle: ''
        },
        {
          label: '取消'
        }
      ]
      setTimeout(() => {
        this.kunkkaFormTablePopup.table.data = Array.from({ length: 20 }, (_, idx) => ({
          aaa: idx,
          bbb: 'bbb' + idx,
          ccc: 'ddd' + idx,
          ddd: 'ddd' + idx
        }))
        this.kunkkaFormTablePopup.table.pagination.total = 20
      }, 1000)
    }
  }
}
</script>
